MyModules.define('listContainer',[],function(){

	function getHtml () {
		var str = '<div class="wrap-widget LdgFormItemList" data-id="'+this.datas.id+'"  data-original-title="'+this.datas.name+'" data-toggle="tooltip">';
		str += '</div>';
		
		return str;
	}
	class Child extends WidgetObject {
	    constructor() {
	        super(); // 调用父类构造函数
	        // 子类可以添加自己的属性或方法
	        this.name = '列表容器';
		    this.datas = {
				//控件属性
				name: '列表容器', //控件名称
				target:'container',
				type: 'listContainerWidget',
				value:{},
				childs: []
			};
		    this.init = function(){
				this.datas.childs = [1];
			};
			this.getHtml = getHtml;
			this.inputTemplate = function(id, value){
	            var str = widgetHtml.textInput('content', this.datas.childs, '列表数');
	            return str;
	        };
	        this.saveData = function(){
	        	var values = $("#myModal form").serializeArray();
				this.datas.value = arrayToObject(values);
				this.datas.childs = [Number(this.datas.value['content'])];
				var node = dragObj.node.getElementById(this.datas['id']);
				var now_length = node.childNodes.length;
				var new_node = dragObj.node;
				for(var x =0; x<this.datas.childs[0];x++){
					if(empty(node.childNodes[x])){
						var container = dragObj.toControl('container');
						var indexs = {parent:this.datas['id'], index:x};
						dragObj.renderNode(container, indexs);
						new_node = dragObj.addToNode(new_node, indexs, container, 0);
					}
				}
				if(now_length > this.datas.childs[0]){
					for (var i = now_length - 1 ; i >=this.datas.childs[0] ; i--) {
						dragObj.removeDo(node.childNodes[i].getAttribute('id'));
					}
				}
	        }
	    }
	}
	return new Child();
});